﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
   public  class Class1
    {
      private static readonly string connStr = "server=.;database=Admin001;uid=sa;pwd=123456";

      
        //public static SqlDataReader Query(string cmdString)
        //{
        //    SqlConnection sqlConnection = new SqlConnection(connStr);

        //    using( SqlCommand sqlCommand = new SqlCommand(cmdString,sqlConnection))
        //    {
               
        //        sqlConnection.Open();

        //        return sqlCommand.ExecuteReader(CommandBehavior.CloseConnection);
        //    }         
        //}

        public static void GetData()
        {
            throw new NotImplementedException();
        }

        public static DataTable GetData(string cmdString)
        {
            SqlConnection sqlConnection = new SqlConnection(connStr);
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(cmdString,connStr);
            DataTable table = new DataTable();
            sqlDataAdapter.Fill(table);
            return table;

        }
    }
}
